package com.xhwl.logistics.service.cent;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhwl.common.dto.cent.sdata.AccountDTO;
import com.xhwl.common.dto.cent.sdata.AccountDetailDTO;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.personnel.StaffDTO;
import com.xhwl.common.query.cent.sdata.AccountQuery;
import com.xhwl.common.query.cent.sdata.StaffQuery;
import feign.Param;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;

import java.util.List;

/**
 * @Author: JCccc
 * @Description:
 * @Date: Create in 13:41 2021/01/12
 */
@FeignClient(value = "cent-data-core",contextId = "account",url = "https://cent.xymind.net:19019/cent-data-core/")
public interface IAccountService {

    /**
     * 根据条件获取员工信息
     */
    @RequestLine(value = "POST /staff-service/list")
    List<StaffDTO> list(@Param("staffQuery") StaffQuery staffQuery);

    /**
     * 根据条件分页获取员工信息
     * @param staffQuery
     * @param page
     * @return
     */
    @RequestLine(value = "POST /staff-service/page")
    Page<StaffDTO> page(@Param("staffQuery") StaffQuery staffQuery, @Param("page") Page page);

    @RequestLine(value = "POST /staff/page")
    ResultJson<Page<StaffDTO>> pageStaffInfo(StaffQuery query);

    /**
     * 创建账号
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @RequestLine(value = "POST /account-service/create-account")
    ResultJson createAccount(@Param("account")Account account, @Param("enterpriseIds")List<Integer> enterpriseIds, @Param("projectIds")List<Integer> projectIds, @Param("roleIds")List<Integer> roleIds);


    /**
     * 修改账号
     * @param operateAccount
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @RequestLine(value = "POST /account-service/update-account")
    ResultJson updateAccount(@Param("operateAccount")Account operateAccount, @Param("account")Account account, @Param("enterpriseIds")List<Integer> enterpriseIds, @Param("projectIds")List<Integer> projectIds, @Param("roleIds")List<Integer> roleIds);

    /**
     * 删除账号
     * @param operateAccount
     * @param accountId
     * @return
     */
    @RequestLine(value = "POST /account-service/delete-account")
    ResultJson deleteAccount(@Param("operateAccount") Account operateAccount, @Param("accountId")Integer accountId);


    /**
     * 动态查找账号信息 -分页
     * @param operateAccount
     * @param page
     * @param accountQuery
     * @return
     */
    @RequestLine(value = "POST /account-service/page-list")
    Page<Account> getAccountPageList(@Param("operateAccount")Account operateAccount ,@Param("page") Page page,@Param("accountQuery") AccountQuery accountQuery);


    /**
     * 动态查找账号信息 -不分页
     * @param operateAccount
     * @param accountQuery
     * @return
     */
    @RequestLine(value = "POST /account-service/list")
    List<Account> getAccountList( @Param("operateAccount")Account operateAccount ,@Param("accountQuery")AccountQuery accountQuery);

    /**
     * 企业-账号关联信息包含填充信息
     * @param enterpriseIdList
     * @return
     */
    @RequestLine(value = "POST /account-service/query-account-enterprise")
    List<AccountDetailDTO> getAccountEnterpriseInfoByIdList(@Param("enterpriseIdList") List<Integer> enterpriseIdList,@Param("accountId") Integer accountId);

    /**
     * 角色-账号 关联信息包含填充信息
     * @param accountIdList
     * @return
     */
    @RequestLine(value = "POST /account-service/query-account-role")
    List<AccountDetailDTO> getAccountRoleInfoByIdList(@Param("accountIdList") List<Integer> accountIdList);



    /**
     * 根据角色id查找 关联的账号id列表
     * @param roleId
     * @return
     */
    @RequestLine(value = "POST /account-service/list-by-role")
    List<Integer> getAccountIdListByRoleId(@Param("id") Integer roleId);


    /**
     * 根据id获取账号信息
     * @param id
     * @return
     */
    @RequestLine(value = "POST /account-service/get-by-id")
    Account findById(@Param("id") Integer id);

    /**
     * 根据手机号获取账号
     * @param phone
     * @return
     */
    @RequestLine(value = "POST /account-service/get-by-phone")
    Account  findByPhone(@Param("phone") String phone);


    /**
     * 业态、账户名 业态下唯一
     * @param loginName
     * @param industryId
     * @return
     */
    @RequestLine(value = "POST /account-service/get-by-loginname")
    Account findByLoginNameAndType(@Param("loginName")String loginName, @Param("industryId")Short industryId);

    /**
     * 重新设置密码     默认密码重置为123456 ，单纯修改的密码由传入而定
     *  目前账号修改 以及 初次登录重新设置密码会调用
     * @param id
     * @param pwd
     * @return
     */
    @RequestLine(value = "POST /account-service/reset-pwd")
    ResultJson  resetPwd(@Param("id") Integer id,@Param("pwd") String pwd);



    /**
     * 初次登录-密码修改
     * @param id
     * @param pwd
     * @return
     */
    @RequestLine(value = "POST /account-service/modify-pwd")
    ResultJson modifyPwd(@Param("id") Integer id, @Param("pwd") String pwd);

    /**
     * 密码校验
     * @param id
     * @param pwd
     * @return
     */
    @RequestLine(value = "POST /account-service/verify-pwd")
    ResultJson verifyPwd(@Param("id") Integer id, @Param("pwd") String pwd);


    /**
     * 修改个人信息 -个人中心
     * @param operateAccount
     * @param account
     * @return
     */
    @RequestLine(value = "POST /account-service/modify-personalInfo")
    ResultJson modifyPersonalInfo(@Param("operateAccount")Account operateAccount, @Param("account") Account account);

    /**
     * 账号查询 （分页） , 可根据企业、项目、角色等条件查询
     *
     * @param page
     * @param accountQuery
     * @return
     */
    @RequestLine(value = "POST /account-service/view-page-list")
    Page<AccountDTO> getPageList(@Param("page") Page page, @Param("accountQuery") AccountQuery accountQuery);

}
